<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //生成器是一个特殊的函数
        //异步编程  纯回调函数  
        function* gun() {
            console.log(111);
            yield 'aaa';
            console.log(222);
            yield 'bbb';
            console.log(333);
            yield 'ccc';
            console.log(444);
            yield 'ddd';
            console.log(555);
        }
        let iter = gun();
        console.log(iter.next());
        console.log(iter.next());
        console.log(iter.next());
        console.log(iter.next());
        console.log(iter.next());
    </script>
</body>

</html>